home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / music4c.sit / Music4C Folder / Sources Folder / MacInterface1.c < prev    next >
Text File  |  1990-06-08  |  3KB  |  119 lines

  1. /*
  2. * ⌐ Graeme Gerrard 1990
  3. * Faculty of Music, University of Melbourne
  4. * Parkville Victoria 3052 Australia.
  5. *
  6. * ARPANET: grae@murdu.ucs.unimelb.edu.au
  7. * telephone: (613) 344 4127, Fax: (613) 344 5346
  8. */
  9. #include    "Music4C.h"
  10. #include    "Music4C_Prototype.h"
  11.  
  12. void   MAC_do_pass12(void);
  13. static pascal char  MyFilter (DialogPtr   theDialog,  EventRecord   *theEvent,  short  *itemHit);
  14. static void  Refresh_Dialog(DialogPtr    GetSelection);
  15. extern    void    prepare_score(void);
  16. Boolean    MAC_Check_Pass12_Events(int, int);
  17.  
  18. extern    OSErr    theErr;
  19. extern    Str255    theMess1;
  20. CursHandle    theCursor;
  21.  
  22. static        Handle         aHandA, aHandB;
  23. static        Handle        aHand;
  24. static        DialogPtr    GetSelection;
  25.  
  26. #define  CANCELButton   1
  27. /* ======================================================== */
  28.  
  29. /* This is an update routine for non-controls in the dialog */ 
  30. /* This is executed after the dialog is uncovered by an alert */ 
  31. static void  Refresh_Dialog(GetSelection) 
  32.     DialogPtr    GetSelection;
  33.     Rect    tempRect;
  34.     short    DType;
  35.     Handle    DItem;
  36.  
  37.     GetDItem(GetSelection, CANCELButton, &DType, &DItem, &tempRect);
  38.     PenSize(3, 3);
  39.     InsetRect(&tempRect, -4, -4);
  40.     FrameRoundRect(&tempRect, 16, 16); 
  41.     PenSize(1, 1); 
  42.     
  43.  
  44. /* ======================================================== */
  45.  
  46.  
  47. void   MAC_do_pass12()
  48. {
  49.     Rect    tempRect, box;
  50.      short    DType;
  51.  
  52.     GetSelection = GetNewDialog(PASS1_2_DIALOG, NIL, (WindowPtr)-1);
  53.     if ( ( theErr = ResError()) != noErr ) {
  54.         PstringCopy((char *)theMess1, "\MAC_do_pass12: Can't open dialog resource");
  55.             OSError(theMess1, NIL, theErr);
  56.     }
  57.     tempRect.top = GetSelection->portRect.top;
  58.     tempRect.left = GetSelection->portRect.left;
  59.     tempRect.bottom = GetSelection->portRect.bottom;
  60.     tempRect.right = GetSelection->portRect.right;
  61.     tempRect.top = ((screenBits.bounds.bottom - screenBits.bounds.top) - (tempRect.bottom - tempRect.top)) / 2;
  62.     tempRect.left = ((screenBits.bounds.right - screenBits.bounds.left) - (tempRect.right - tempRect.left)) / 2;
  63.     MoveWindow(GetSelection, tempRect.left, tempRect.top, TRUE);
  64.     ParamText("\p", NIL, NIL, NIL);
  65.     ShowWindow(GetSelection);
  66.     SelectWindow(GetSelection);
  67.     SetPort(GetSelection);
  68.      
  69.      
  70.     /* Setup initial conditions */
  71.     DrawDialog(GetSelection);
  72.     GetDItem(GetSelection, 2, &DType, &aHandA, &box);
  73.     GetDItem(GetSelection, 4, &DType, &aHandB, &box);
  74.  
  75.     theCursor = GetCursor(watchCursor);
  76.     SetCursor(*theCursor);
  77.     
  78.     prepare_score();
  79.  
  80.     DisposDialog(GetSelection); 
  81.     InitCursor();
  82. }
  83.  
  84.  
  85. Boolean    MAC_Check_Pass12_Events(whichPass, SectionNo)
  86.     int    whichPass;
  87.     int    SectionNo;
  88. {
  89.     EventRecord    event;
  90.     long        Number;
  91.     char        theString[256];
  92.     WindowPtr    windowp;
  93.     long    aLong;
  94.     char    c;
  95.     short    itemHit;
  96.     
  97.     
  98.     if ( whichPass == 1 )
  99.         SetIText(aHandA, "\pPass1");
  100.     else if ( whichPass == 2 )
  101.         SetIText(aHandA, "\pPass2");
  102.         
  103.         
  104.     Number = (long)SectionNo;
  105.     NumToString(Number, theString);
  106.     SetIText(aHandB, theString);
  107.  
  108.     GetNextEvent(everyEvent, &event);
  109.     if ( IsDialogEvent(&event) ) {
  110.         if ( DialogSelect(&event, &GetSelection, &itemHit)) {
  111.             if ( itemHit == CANCELButton) {
  112.                 return(FALSE);
  113.             }
  114.         }
  115.     }
  116. }
  117.